<?php

require_once('Search/protoType.php');

class Search_VoteType extends protoType {
	protected $fields = array(
	'title',
	'question',
	);
	
	protected $title_field = 'title';

	protected function concatFields() {
		$text = '';
		$data = $this->object->data;

		foreach ( $this->fields as $field ) {
			if ( isset($data[$field]) && !empty($data[$field]) ) {
				$text .= " {$data[$field]}";
			}
		}

		foreach ( $data['answers'] as $answer ) {
			$text .= " {$answer['text']}";
		}

		return $text;
	}

}